import Vue from 'vue'
import Lodash from 'lodash'

const directives = require.context(
	'./',
	false,
	/\.js$/
);

directives.keys().forEach(fileName => {
	if (!fileName.includes('index')) {
		const name = fileName.split('/').pop().replace(/\.\w+$/, '');
		// const Directive = require(`${fileName}`);
		// console.log(Directive.default || Directive)
		// console.log(directives(fileName).default || directives(fileName))
		Vue.directive(
			Lodash.camelCase(name),
			// Directive.default || Directive
			directives(fileName).default || directives(fileName)
		);
	}
});